﻿using System.Data.Entity;
using System.Runtime.Remoting.Messaging;

namespace CashOrCard.Models
{
    public class CocContextFactory
    {
        public static DbContext GetCurrentDbContext()
        {
            DbContext dbcontext = CallContext.GetData("DbContext") as DbContext;

            if (dbcontext == null)
            {
                dbcontext = new CashOrCardContext();
                CallContext.SetData("DbContext", dbcontext);
            }
            return dbcontext;
        }
    }
}